const express = require("express")
const fs = require('fs');
const path = require('path');
const app = express();

app.use('/apidoc', express.static(path.join(__dirname, '../apidoc')));

// shelljs.exec('apidoc -i src/ -o apidoc/');

app.get('/', function (req, res) {
    fs.readFile(path.join(__dirname, '../apidoc/index.html'), 'utf8', (err, data) => {
        if (err) {
            return res.status(500).send('server internal error');
        }
        res.end(data);
    })
});
let port = 4004;
app.listen(port, function () {
    console.log(`api server is running,the port ${port} is open.`);
});